import mutations from "@/store/mutations";
import asyncRoute from "@/router/asyncRoute";

export default {
  state: () => {
    return {
      asyncroutes: []
    };
  },
  getters: {},
  mutations: {
    [mutations.SET_ASYNCROUTES](state, routes) {
      state.asyncroutes = routes;
    }
  },
  actions: {
    getAsyncRoutes({ commit }) {
      return new Promise((resolve, reject) => {
        //todo match routes
        commit(mutations.SET_ASYNCROUTES, asyncRoute);
        resolve(asyncRoute);
      });
    }
  }
};
